<script setup>
import { appArr } from '../../config/route'
import { ref } from "vue"
import { useRouter } from "umi"
const router = useRouter()
const dataArr = appArr.map(item => {
    item.container = item.container.replace('#', '')
    return item
})
// 切换子路由
const appSwitching = (app) => {
    console.log("当前子应用：", app.name);
    router.push({
        path: app.activeRule
    })
}
router.push({
    path: dataArr[0].activeRule
})

</script>
<template>
    <div>
        <div>
            <span class="btn" @click="appSwitching(item)" v-for="(item, index) in dataArr" :key="item.name">{{
                item.name
            }}</span>
            <router-view></router-view>
        </div>
    </div>
</template>

<style scoped lang="scss">
.btn {
    padding: 5px 15px;
    background-color: wheat;
    border-radius: 10px;
    margin-left: 20px;
    margin-bottom: 40rpx;
}
</style>